/*
day67
2019.11.3
*/
#include<stdlib.h>
struct TreeNode{
	int val;
	struct TreeNode *left;
	struct TreeNode *right;
};


struct TreeNode* searchBST(struct TreeNode* root, int val){
	if(!root) return NULL;
	if(root->val==val) return root;
	
	struct TreeNode *res=searchBST(root->left,val);
	if(res) return res;
	
	return searchBST(root->right,val);

}


struct TreeNode* searchBST2(struct TreeNode* root, int val)
{
	struct TreeNode *cur=root;
	while(cur)
	{
		if(cur->val==val) return cur;
		else if(val>cur->val) cur=cur->right;
		else cur=cur->left;
	}
	return NULL;
 } 

int main()
{
	return 0;
}
